<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>SL会员商城登录系统</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<script type="text/javascript" src="js/jquery-1.12.4.js"></script>
<script type="text/javascript" src="layui/layui.js"></script>
<link rel="stylesheet" href="layui/css/layui.css">
<script type="text/javascript" src="layer/layer.js"></script>
<link rel="stylesheet"
	href="${pageContext.request.contextPath }/css/login.css" />


</head>

<body>
	<div id="about_hide">
		<div id="about">
			<div id="about1">
				<h1 style="color: white; font-family: '楷体'; font-size: 30px;">SL会员商城管理系统</h1>
			</div>
			<div style="color: red; font-family: '楷体'; font-size: 30px;" id="about2"></div>
			<div class="layui-form-item">
				<label class="layui-form-label"
					style="color: #F8F8F8; font-weight: 600;">登录账号:</label>
				<div class="layui-input-block">
					<input type="text" name="loginCode" id="loginCode" required
						lay-verify="required" placeholder="请输入登录账号" autocomplete="off"
						class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label id="pwd" class="layui-form-label"
					style="color: #F8F8F8; font-weight: 600;">登录密码:</label>
				<div class="layui-input-block">
					<input type="password" name="password" id="password" required
						lay-verify="required" placeholder="请输入用户密码" autocomplete="off"
						class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label id="yzmcode" class="layui-form-label"
					style="color: #F8F8F8; font-weight: 600;">验证码:</label>
				<div class="layui-input-block">
					<input type="text" name="code" id="code" required
						lay-verify="required" placeholder="请输入验证码" autocomplete="off"
						class="layui-input">
				</div>
				<div style="margin-left:110px;margin-top:20px">
						<div class="col-sm-4" >
							<img id="codeImg" src="yzm" class="img-responsive"
								style="display: block;width:100px;height: 40px">
						</div>
						<a id="change" style="color: #F8F8F8; font-weight: 600;">看不清楚换一张</a>
				</div>
				</div>
			<div class="layui-form-item">
				<div class="layui-input-block">
					<button class="layui-btn" id="btn">登录</button>
					<button class="layui-btn layui-btn-primary">取消</button>
				</div>
			</div>

		</div>
	</div>

	<
	<script type="text/javascript">
		$("#change").click(function() {
			$("#codeImg").attr("src", "yzm?" + Math.floor(Math.random() * 100))
		})
	</script>
	<script type="text/javascript"
		src="${pageContext.request.contextPath }/js/jquery-1.12.4.js"></script>
	<script type="text/javascript"
		src="${pageContext.request.contextPath }/layui/layui.js"></script>
	<script type="text/javascript">
		$("#btn").click(
				function() {
					var loginCode = $.trim($("#loginCode").val());
					var password = $.trim($("#password").val());
					var code = $.trim($("#code").val());

					$.post("user/dologin.html", "longinCode=" + loginCode
							+ "&password=" + password+"&code="+code, function(result) {
						if (result != "" && result == 'ok') {
							window.location.href = "user/mainpage.html";
							$("#about1").html("");
						} else if (result == 'no') {
							$("#about2").css("color", "red");
							$("#about2").html("登录失败！请重试。");
							/* 					layer.tips("登录失败！请重试", "#pwd"); */

							$("#longinCode").val("");
							$("#password").val("");
						}else if(result == 'check'){
							$("#about2").css("color", "red");
							$("#about2").html("验证码错误！请重试。");
							/* 					layer.tips("登录失败！请重试", "#pwd"); */

							$("#longinCode").val("");
							$("#password").val("");
							$("#code").val("");
						}
					}, "text");

				});
	</script>
</body>

</html>
